package com.example.chapter03;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.TextView;



public class ViewBorderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_border);
        TextView weight =findViewById(R.id.weight);
        //指定高度必须为wrap_content才可以修改
        //获取params的布局参数（含高度和宽度）
        ViewGroup.LayoutParams params = weight.getLayoutParams();
        //修改布局中的宽度数值，默认px单位，需要把dp数值转换为px数值

        //params.width = utils.dip2px(this,300);
        //设置weight的布局参数
        weight.setLayoutParams(params);
    }
}